<?php
session_start();

$col=':';
$dbuser=$_SESSION['dbuser'];
$dbpass=$_SESSION['dbpass'];
$dbport=$_SESSION['dbport'];
$dbhost=$_SESSION['dbhost'];
$dbname=$_SESSION['dbname'];

if ($dbhost=="localhost") {
   $dbhost = "127.0.0.1";
   } 

$dbhostport = $dbhost . $col . $dbport ; 

$con = mysql_connect($dbhostport, $dbuser, $dbpass);
if (!$con)
    {
      $error=mysql_error();
      $_SESSION['error'] = $error;
      
      Header("Location: error.php");
    }
  
mysql_select_db($dbname, $con);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<TITLE>SamMy - Securich GUI tool - Welcome</TITLE>
	<STYLE type="text/css" media="all">
	
	body {
		background: #f70;
		font: 0.8em arial, helvetica, sans-serif;
		margin: 0;
		padding: 0;
		height:100%;
        padding-bottom:35px;   /* Height of the footer */
	}
	
	#footer {
        position: absolute;
 	    bottom: 40px;
	    width:100%;
	    height:15px;   /* Height of the footer */
	    color: #FFF;
    }
	
	#header {
		background-color: white;
	}
	
    #header ul {
		list-style: none;
		padding: 0;
		margin: 0;
		background: white;
		float: left;
		width: 100%;
    }
    
	#header li {
		float: left;
		margin: 0 1em 0 0;
    }
    
	#header a {
		text-decoration: none;
		display: block;
		width: 6em;
		padding: 0 0.5em;
		font-weight: bold;
		color: black;
		border-bottom: 0.5em solid #fc6;
		color: #fc6;
    }
	
	#header a:hover {
		color: #fa3;
		border-color: #fa3;
	}
	
	#header #selected a {
		color: #f80;
		border-color: #f80;
	}
	
	#content {
        position:absolute;
        top: 70px;
        left:60px;
		clear: both;
		color: white;
		padding: 1em;
	}
	
	#content p {
		margin: 0 0 1em 0;
	}
	
	h1 {
		margin: 0;
		padding: 0.5em 0 1em 0.5em;
		color: #f80;
		font-size: 1.5em;
		font-style: italic;
	}

	</STYLE>
	
</HEAD><BODY>


<DIV id="header">

<H1>SamMy - The GUI frontend for Securich, the security plugin for MySQL</H1>

<UL>
	<LI id="selected"><A href="welcome.php">Home</A></LI>
	<LI><A href="accounts.php">Accounts</A></LI>
	<LI><A href="grant_revoke.php">Privileges</A></LI>
	<LI><A href="configure.php">Config</A></LI>
	<LI><A href="securich.php">Securich</A></LI>
	<LI><A href="help.php">Help</A></LI>
	<LI><A href="logout.php">Log Out</A></LI>
</UL>
</DIV>

<DIV id="content">
<table>
  <tr>
    <td colspan="3">
      <b>Connection Information</b>
      <br><br>
    </td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>User: </td>
    <td><?echo "$dbuser"?><br></td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>Host: </td>
    <td><?echo "$dbhost"?><br></td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>Port: </td>
    <td><?echo "$dbport"?><br></td>
  </tr>
  <br><br>
  
  <tr>
    <td colspan="3">
      <br><br><br>
      <b>Server Information:</b><br>
      <br>
    </td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>Version: </td>
    <td>
        <?
	 	  $result = mysql_query("SELECT version() as version");

          echo mysql_error();
          $result_tmp=mysql_fetch_object($result);
          echo $result_tmp->version;
        ?>
      <br></td>
  </tr>
  <br><br>
  
    <tr>
    <td colspan="3">
      <br><br><br>
      <b>Securich Information:</b><br>
      <br>
    </td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>Version: </td>
    <td>
        <?
	 	  $result = mysql_query("select VERSION as version from sec_version");

          echo mysql_error();
          $result_tmp=mysql_fetch_object($result);
          echo $result_tmp->version;
        ?>
      <br></td>
  </tr>
  <tr>
    <td width="25px"></td>
    <td>Last Updated: </td>
    <td>
        <?
	 	  $result = mysql_query("select UPDATED_TIMESTAMP as timestamp from sec_version");

          echo mysql_error();
          $result_tmp=mysql_fetch_object($result);
          echo $result_tmp->timestamp;
        ?>
      <br></td>
  </tr>
  <br><br>
  
</table>

</DIV>

   <DIV id="footer" align="left">
   <table>
     <tr>
       <td width="23px">&nbsp;</td>
       <td>
         Copyright &copy; Darren Cassar a.k.a. preacher<br />
         Developed by Darren Cassar <?php echo date("Y"); ?> - GPLv2
       </td>
     </tr>
   </table>
   </DIV>




</BODY></HTML>